<template>
    <view class="uni-content">
		<view class="cu-list menu sm-border">
			<view class="cu-item arrow" v-for="(item, index) in list" :key="index" @click="navToPage(item)">
				<view class="content">
					<text>{{ item.title }}</text>
				</view>
				<view :class="item.subtitle_class">{{ item.subtitle }}</view>
			</view>
		</view>
	</view>
</template>

<script>
    export default {
		data() {
			return {
				account_bg:'',
				userinfo:[],
				list:[],
				currentPage:'/pages/user/person'
			};
		},
		onLoad: function (option) {
			this.helper.checkLogin();
			this.getData();
			this.getAccountNav();
		},
		methods: {
			getData:function(){
				//获取基础参数
				// uni.showLoading({
				// 	title:"数据加载中",
				// 	mask:true
				// })
				var info = uni.getStorageSync("userinfo");
				let timestamp = this.helper.now();
				let sign = this.helper.setSign(['username='+info.username,'token='+info.token,'timestamp='+timestamp]);
				this.helper.req({
					api:"getUserInfo",
					timestamp:timestamp,
					data:{username:info.username,token:info.token},
					header:{sign:sign},
					method:'GET',
				}).then(res=>{
					this.userinfo = res.data.data.userinfo;
					if(this.userinfo.avatar){
						this.avatar = this.weburl + this.userinfo.avatar;
					}
					setTimeout(() => {
						uni.hideLoading();
					}, 300);
				})
			},
			getAccountNav:function(){
				//获取基础参数
				// uni.showLoading({
				// 	title:"数据加载中",
				// 	mask:true
				// })
				var info = uni.getStorageSync("userinfo");
				let timestamp = this.helper.now();
				let sign = this.helper.setSign(['token='+info.token,'timestamp='+timestamp]);
				this.helper.req({
					api:"getAccountNav",
					timestamp:timestamp,
					data:{token:info.token},
					header:{sign:sign},
					method:'GET',
				}).then(res=>{
					this.list = res.data.data.list;

					setTimeout(() => {
						uni.hideLoading();
					}, 300);
				})
			},
			navToPage: function(e) {
				return uni.navigateTo({
					url: e.url
				});
			},
			navToUrl: function(url) {
				return uni.navigateTo({
					url: url
				});
			}
		},
	};
</script>

<style lang="scss">

.user-section {
    height: 270upx;
    position: relative;
}
.user-info-box {
    height: 278upx;
    position: relative;
    color: #fff
}
.user-info-box .info-box .username {
	font-size: 40upx;
	line-height: 80upx;
	padding-top: 60upx;
}
.user-info-box .info-box .phone{
	background-repeat: no-repeat;
	background-size: 25px;
	background-position: 39%;
	padding: 10px;
}
.cu-list.menu>.cu-item {
    color: #333
}
.cu-list.menu>.cu-item .content {
    font-size: 28upx
}
.cu-list.menu>.cu-item .content uni-text[class*=cuIcon] {
    width: auto;
    font-size: 28upx
}
.cu-list.grid>.cu-item uni-text {
    font-size: 28upx;
    color: #333
}
.icon_task{
	width: 100upx;
	height: 100upx;
	margin: 0 auto;
}
.icon_nav{
	width: 50%;
	margin: 0 auto;
}
</style>